<?php
    
    $templ = new XTemplate('sites/tpml/qlmon/insert.html');
    $sql = "SELECT * FROM khoi";
    $array = $db->Execute($sql);
    foreach($array as $val){
        $templ->insert_loop('INSERT.LOOP',array('LOOP'=>$val));
    }
    if($_POST){
        $tenmon = $_POST['tenmonhoc'];
        $khoi = $_POST['tenkhoi'];
        $db->Execute("INSERT monhoc(ten,id_khoi) VALUES('$tenmon','$khoi')");
        header('Location: index.php');
    }
    $templ->assign('tit','Thêm môn học');
    $templ->parse('INSERT');
    $maincontent = $templ->text('INSERT');
?>